fix: clear tool output and attachments during compaction prune#16162
fix: clear tool output and attachments during compaction prune#16162guazi04 wants to merge 1 commit intoanomalyco:devfrom
Conversation
When compaction prunes old tool outputs, only the `time.compacted` timestamp was being set — the actual output string and attachments array remained in storage indefinitely. This caused unbounded storage growth (observed 774 MB database in 3 weeks, with 81% being part data). Changes: - Clear output and attachments when prune marks parts as compacted - Add prune() calls before both compaction triggers in prompt.ts to reduce context before LLM summarization - Add tests for prune clearing behavior and config respect Fixes part of anomalyco#16101
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found related PRs that address similar issues: Potentially Related PRs:
Note: PR #7049 appears to be addressing the same core problem (clearing tool output and attachments to prevent memory/storage leaks). You should verify if this is a duplicate or if PR #16162 is an update/fix to the previous approach. |
|
Superseded by #16175 which includes this fix plus the full MVP (CLI commands, VACUUM support, cross-project cascade fix). |
Problem
When compaction prunes old tool outputs, only the
time.compactedtimestamp was being set — the actual output string and attachments array remained in storage indefinitely. This caused unbounded storage growth.Evidence:
Solution
This PR clears the actual data when marking parts as compacted:
compaction.ts (2 lines):
outputandattachmentsarray inprune()when settingtime.compactedprompt.ts (2 calls):
prune()calls before both compaction triggers to reduce context before LLM summarizationTests (new coverage):
Testing
Fixes part of #16101